#ifndef	_HASH_H_
#define	_HASH_H_
#ifdef _USE_HASH_TABLE
#include <stdint.h>

typedef	struct hash hash_t;
typedef	uint32_t (*hashfunc_t)(uint32_t,void *);

hash_t* hash_alloc(uint32_t buckets, hashfunc_t hash_func);
void hash_free(hash_t *h_t);
//这个返回的就是指向值的指针
void* hash_lookup_entry(hash_t *hash, void* key,
		 uint32_t key_size, uint32_t *val_len);
void hash_add_entry(hash_t *hash, void *key, uint32_t key_size,
							 void *value, uint32_t value_size);
void hash_free_entry(hash_t *hash, void *key, uint32_t key_size);
//这里专门为除留余数法实现一个质数判断算法，方便进行计算
uint32_t cacl_max_prime(uint32_t max_limit);
//获取一个不超过max_limit的最大质数
inline uint32_t get_max_prime_num(void);
#endif

#endif
